import java.util.List;

import junit.framework.TestCase;


public class testParser extends TestCase {

	public void testParse() throws Exception {
		
		List expected = new Lista();
		List expected1 = new Lista();
		
		expected.add("'");
		expected.add(1.0);
		expected1.add(2.0);
		expected1.add(3.0);
		expected.add(expected1);
		
		//System.out.println(expected);
		//System.out.println(Parser.parse("'(1(2 3))"));
		//assertEquals(expected, Parser.parse("'(1(2 3))"));
		
		if(!((((Lista) Parser.parse("'(1(2 3))")).equals(expected))))
			fail();
			
		expected = new Lista();
		
		expected.add("car");
		expected1=new Lista();
		expected1.add("'");
		expected1.add(1.0);
		expected1.add(2.0);
		expected1.add(3.0);
		expected.add(expected1);
		
		//assertEquals(expected, Parser.parse("car '(1 2 3)"));
		
		if(!(((Lista) Parser.parse("(car '(1 2 3))")).equals(expected)))
			fail();
		
		try{
			
			Parser.parse("car (1 2 ");
			fail("Exception should have been thrown");
		}catch(Exception e){
			
			
		}
		
	}

}
